package com.life.ai.server.common.excel;

import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * ExcelResultVo
 *
 * @author kylewka
 * @since 2023/11/17
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ExcelResultVo {

    /**
     * 成功处理的对象数量
     */
    @ApiModelProperty(value = "成功处理的对象数量")
    private int successCount;

    /**
     * 处理异常的对象数量
     */
    @ApiModelProperty(value = "处理异常的对象数量")
    private int errorCount;

    /**
     * 错误列表
     */
    @ApiModelProperty(value = "错误列表")
    private List<String> errorList;

    public ExcelResultVo(ExcelResult<?> excelResult) {
        this.successCount = excelResult.getSuccessCount();
        this.errorCount = excelResult.getErrorList().size();
        this.errorList = excelResult.getErrorList();
    }
}
